package com.haojin.exer;

import org.junit.Test;

import java.io.File;
import java.io.IOException;

/**
 * @author .29.
 * @create 2022-04-13 20:50
 */
public class FileDemo {
    @Test
    public void test1() throws IOException {
        File file1 = new File("D:\\study\\io\\hello.txt");
        //创建一个与file1同目录下的另一个文件，文件名为：haha.txt
        File file2 = new File(file1.getParent(),"haha.txt");
        boolean newFile = file2.createNewFile();
        if(newFile){
            System.out.println("创建成功");
        }
    }
}
